Ouvrir Forgem Studio V2 ↗
Identité en direct WebGL · Temps réel · Export natif
Une marque qui ne tient pas en place
Your Brand
Your tagline here
LOOK / Molten
LIVE 60 FPS8 SHADERS14 FORMATS
Brand logo
Your Brand
Your tagline here · FORGEM
SHADER WEBGL
MODULES 13
PALETTE RACE ORANGE

Fonds d'écran tous formats.

iPhone, iPad, Android, desktop 4K, social media — le même shader animé décliné en 12 formats prêts à télécharger.

Teinte0°
Intensité1.0
Vitesse1.0
Échelle1.0
Overlay
Format vidéo
Durée vidéo
01

Mobile

02

Réseaux sociaux

03

Desktop & bannières

Post produit Instagram.

Template 1080×1080 avec emplacement produit, prix et badge. Upload ta photo (PNG transparent idéal), ajuste les textes, télécharge en PNG ou MP4.

DÉMO
Ajoute une photo produit (PNG transparent)
Produit démo 01
79€

Personnaliser

Loaders & splash.

6 animations de chargement aux couleurs de ta marque — copie le code et colle dans ton site ou ta PWA. CSS pur, zéro dépendance.

Bolt Spin
.forgem-load-1 · 60px
3 Dots Pulse
.forgem-load-2 · inline
Scan Line
.forgem-load-3 · 120×4
Ring & Bolt
.forgem-load-4 · 80px
Equalizer
.forgem-load-5 · 40h
Brand logo
Splash Screen
.forgem-load-6 · fullscreen

Header email HTML.

Bannière 1200×400 statique pour newsletters (Mailchimp, Brevo, Zoho Campaigns). Inclut le code HTML inline compatible tous clients email.

Carte de visite 85×55.

Format européen standard, recto avec ton nom, verso avec le shader animé. Téléchargeable en PNG 300dpi prêt pour l'imprimeur (Vistaprint, Onlineprinters, Printoclock).

Tes infos

Recto

Your tagline here
Votre nom Founder
+33 6 00 00 00 00
contact@yourbrand.com

Verso

Brand logo
Your tagline here

Export vidéo.

Capture 3 secondes du shader animé en MP4 (WebM). Idéal pour stories Instagram, TikTok, ou comme background animé sur un site. Compatible Safari iPhone.

Preview live · 1080×1080

Capture vidéo

L'export utilise les paramètres actuels du shader (palette, intensité, vitesse, taille) que tu as configurés dans l'onglet Fonds d'écran. Change les valeurs là-bas si besoin, puis reviens ici.

Durée
3.0s
Résolution
1080²
Frames
90
FPS
30
Format de sortie
WebM lit partout (Chrome, Firefox, navigateurs Mac/Linux récents). Idéal site web.

Poster A4 print.

Format 210×297mm à 300dpi (2480×3508px) pour impression salons, vitrines, distributeurs. Personnalise titre, drop et infos — export PNG haute définition prêt pour l'imprimeur.

C R É A T I O N · É D I T I O N 0 1
DEMO-001
DES IDÉES.EN ACTION.
U N E I D E N T I T É E N M O U V E M E N T
CRÉER · TESTER · EXPORTER

Texte du poster

Kit stickers.

Stickers ronds et rectangulaires pour cartons d'expédition, casques, tank pads. Format imprimeur 300dpi avec fond shader animé. Compatible Vistaprint, Stickermule, Onlineprinters.

01

Ronds

02

Rectangulaires

Landing Linktree mobile.

Page "bio link" style Linktree avec fond shader, avatar, stats, et boutons custom. Compatible Instagram bio, TikTok bio, signature email. Export HTML autonome (à héberger sur Netlify, GitHub Pages, Vercel).

Logos animés.

4 lockups SVG animés en CSS pur — header de site, splash écran, footer email, sticker mobile. Copie le SVG complet (animation incluse) ou télécharge le fichier .svg autonome.

Your BrandYour tagline here
Horizontal · Bolt spin
.lk-1 · header / footer
Your BrandY O U R T A G L I N E
Vertical · Stroke draw
.lk-2 · splash / hero
Your Brand
Badge · Pulse ring
.lk-3 · CTA / sticker
YB Your Brand · EST. 2026
Monogram · Ring spin
.lk-4 · avatar / favicon

Product card Snipcart.

Template HTML/CSS de fiche produit avec attributs data-item-* Snipcart prêts à coller dans la home ou une page catégorie. CSS auto-contenu, zéro framework.

Aperçu live

DÉMO
Aucune photo
(uploader ci-contre)
ACCESSOIRE

Produit démo 01

Exemple fictif à personnaliser avec votre produit.

79€
EN STOCK

Produit

Open Graph 1200×630.

Visuel pour les meta tags og:image et twitter:image — affichage WhatsApp, iMessage, Slack, LinkedIn, X, Facebook quand on partage un lien produit. Format imposé 1.91:1.

ACCESSOIRE

Produit démo 01

Exemple fictif · visuel à personnaliser

79€ DÉMO
Brand logo

Visuel partage produit

Favicon & PWA kit.

Génère les 7 tailles d'icônes requises pour un site moderne : favicon (16/32/48), Apple Touch (180), PWA (192/512), maskable (512 avec safe-zone). Source : logo gear par défaut, ou upload custom.

Fond icônes :

HTML à coller dans <head>

Photo Insta.

Drop tes propres photos (fond bétonné, atelier, garage — peu importe), pose ton branding par-dessus, et exporte au format Insta. Pas de shader, pas de fond retiré : la photo reste brute, les stickers sont calibrés pour ressortir sur du béton brut.

📷

Charge une photo dans le panneau de droite pour démarrer.
Tout se met à jour en direct.

Aucune photo chargée
01Format Insta
02Marque
Logo
Wordmark
@yourbrand
#hashtag
Cadre orange
Variante du logo
Gear
Clean
Officiel
Lockup
Position logo
Couleur logo
Taille logo12%
03Texte custom (optionnel)
Position texte
Couleur texte
04Béton-friendly
Vignette
Grain matière
Boost contraste
Assombrir fond
Intensité grain14%
Format 1080 × 1080 aucune photo
Action effectuée
`; } async function renderLinktreePNG(W,H,forKit=false){ await document.fonts.load(`700 80px ${FD}`); await document.fonts.load(`600 40px ${FD}`); const logo=await loadGearLogo(); const off=renderFrameAt(W,H,state); const out=document.createElement('canvas');out.width=W;out.height=H; const ctx=out.getContext('2d'); ctx.fillStyle='#000';ctx.fillRect(0,0,W,H); ctx.drawImage(off,0,0); releaseKitFrame(off); // Fade overlay const fade=ctx.createLinearGradient(0,0,0,H); fade.addColorStop(0,'rgba(6,6,7,.55)'); fade.addColorStop(1,'rgba(6,6,7,.85)'); ctx.fillStyle=fade;ctx.fillRect(0,0,W,H); const cx=W/2; let y=H*.13; // Avatar circle with gear logo const avR=W*.09; ctx.save(); ctx.beginPath();ctx.arc(cx,y,avR,0,Math.PI*2);ctx.clip(); ctx.fillStyle='#0F0F14';ctx.fillRect(cx-avR,y-avR,avR*2,avR*2); if(logo){ ctx.drawImage(logo,cx-avR,y-avR,avR*2,avR*2); } ctx.restore(); // ring ctx.beginPath();ctx.arc(cx,y,avR,0,Math.PI*2); ctx.strokeStyle='rgba(255,92,0,.6)';ctx.lineWidth=W*.005;ctx.stroke(); y+=avR+W*.05; // Handle const hfs=Math.round(W*.062); ctx.font=`700 ${hfs}px ${FD}`; ctx.textAlign='center';ctx.textBaseline='alphabetic'; const handle=linktreeState.handle==='YOUR BRAND'?window.brandName():linktreeState.handle; const idx=handle.indexOf(' '); if(idx>=0){ const a=handle.slice(0,idx)+' ',b=handle.slice(idx+1); const wa=ctx.measureText(a).width,wb=ctx.measureText(b).width; const sx=cx-(wa+wb)/2; ctx.fillStyle='#fff';ctx.textAlign='left';ctx.fillText(a,sx,y); ctx.fillStyle=kitPrimaryColor();ctx.fillText(b,sx+wa,y); } else { ctx.fillStyle='#fff';ctx.fillText(handle,cx,y); } y+=W*.04; // Bio ctx.textAlign='center'; ctx.font=`700 ${Math.round(W*.022)}px ${FD}`; ctx.fillStyle='rgba(255,255,255,.7)'; const bio=linktreeState.bio==='YOUR TAGLINE HERE'?window.brandTagline():linktreeState.bio; ctx.fillText(bio.split('').join(' '),cx,y); y+=W*.07; // Stats pill const stLabels=['FOLLOWERS','DROPS','RIDERS']; const stFs=Math.round(W*.038); const stSubFs=Math.round(W*.018); ctx.font=`700 ${stFs}px ${FD}`; const colW=W*.16; const pillW=colW*3;const pillH=W*.085; ctx.fillStyle='rgba(0,0,0,.5)'; const pillR=pillH/2; ctx.beginPath(); ctx.moveTo(cx-pillW/2+pillR,y); ctx.lineTo(cx+pillW/2-pillR,y); ctx.quadraticCurveTo(cx+pillW/2,y,cx+pillW/2,y+pillR); ctx.lineTo(cx+pillW/2,y+pillH-pillR); ctx.quadraticCurveTo(cx+pillW/2,y+pillH,cx+pillW/2-pillR,y+pillH); ctx.lineTo(cx-pillW/2+pillR,y+pillH); ctx.quadraticCurveTo(cx-pillW/2,y+pillH,cx-pillW/2,y+pillH-pillR); ctx.lineTo(cx-pillW/2,y+pillR); ctx.quadraticCurveTo(cx-pillW/2,y,cx-pillW/2+pillR,y); ctx.closePath();ctx.fill(); ctx.strokeStyle='rgba(255,255,255,.08)';ctx.lineWidth=1.5;ctx.stroke(); // Stat content linktreeState.stats.forEach((v,i)=>{ const x=cx-pillW/2+colW/2+i*colW; ctx.font=`700 ${stFs}px ${FD}`; ctx.fillStyle='#fff'; ctx.textAlign='center';ctx.textBaseline='alphabetic'; ctx.fillText(v,x,y+pillH*.55); ctx.font=`700 ${stSubFs}px ${FD}`; ctx.fillStyle='rgba(255,255,255,.5)'; ctx.fillText(stLabels[i],x,y+pillH*.85); if(i<2){ ctx.strokeStyle='rgba(255,255,255,.1)';ctx.lineWidth=1; ctx.beginPath(); ctx.moveTo(cx-pillW/2+colW*(i+1),y+pillH*.2); ctx.lineTo(cx-pillW/2+colW*(i+1),y+pillH*.8); ctx.stroke(); } }); y+=pillH+W*.05; // Buttons const btnW=W*.85; const btnH=W*.105; const btnR=12; const btnGap=W*.018; const btnFs=Math.round(W*.026); linktreeState.links.forEach((l,i)=>{ const bx=cx-btnW/2; const featured=i===0; if(featured){ ctx.fillStyle=kitPrimaryColor(); } else { ctx.fillStyle='rgba(255,255,255,.08)'; } ctx.beginPath(); ctx.moveTo(bx+btnR,y);ctx.lineTo(bx+btnW-btnR,y); ctx.quadraticCurveTo(bx+btnW,y,bx+btnW,y+btnR); ctx.lineTo(bx+btnW,y+btnH-btnR); ctx.quadraticCurveTo(bx+btnW,y+btnH,bx+btnW-btnR,y+btnH); ctx.lineTo(bx+btnR,y+btnH); ctx.quadraticCurveTo(bx,y+btnH,bx,y+btnH-btnR); ctx.lineTo(bx,y+btnR);ctx.quadraticCurveTo(bx,y,bx+btnR,y); ctx.closePath();ctx.fill(); if(!featured){ ctx.strokeStyle='rgba(255,255,255,.12)';ctx.lineWidth=1.5;ctx.stroke(); } // Label ctx.font=`700 ${btnFs}px ${FD}`; ctx.fillStyle=featured?kitTextColor():'#fff'; ctx.textAlign='left';ctx.textBaseline='middle'; const label=l.label.toUpperCase(); const lblX=bx+btnH*.6; // truncate if too long let lbl=label; while(ctx.measureText(lbl).width>btnW-btnH*1.4&&lbl.length>3){lbl=lbl.slice(0,-1);} if(lbl!==label)lbl=lbl.slice(0,-1)+'…'; ctx.fillText(lbl,lblX,y+btnH/2); // Arrow › ctx.font=`700 ${btnFs*1.2}px ${FD}`; ctx.fillStyle=featured?'rgba(0,0,0,.55)':'rgba(255,255,255,.55)'; ctx.textAlign='right'; ctx.fillText('›',bx+btnW-btnH*.4,y+btnH/2); y+=btnH+btnGap; }); // Foot ctx.font=`700 ${Math.round(W*.016)}px ${FD}`; ctx.fillStyle='rgba(255,255,255,.35)'; ctx.textAlign='center';ctx.textBaseline='alphabetic'; ctx.fillText(window.brandName().toUpperCase().split('').join(' ')+' · P O W E R E D B Y L I G H T N I N G',cx,H-W*.05); if(forKit)return out; out.toBlob(blob=>{ const url=URL.createObjectURL(blob); const a=document.createElement('a'); a.href=url;a.download=`${window.brandSlug()}_Linktree_${state.paletteName.replace(/\s+/g,'-')}_${W}x${H}.png`; a.click();setTimeout(()=>URL.revokeObjectURL(url),1500); toast('Linktree PNG téléchargé'); },'image/png'); } /* ════════════════════════════════════════════════════════════ 10 — LOGOS ANIMÉS ════════════════════════════════════════════════════════════ */ const LOGO_SVGS={ '1':` YOUR BRAND Y O U R T A G L I N E `, '2':` YOUR BRAND Y O U R T A G L I N E `, '3':` YOUR BRAND `, '4':` YB YOUR BRAND · EST. 2026 ` }; function getBrandedSVG(id){ // Inject live brand name/tagline into the static SVG strings before export const bn=window.brandName(); const bt=window.brandTagline(); return LOGO_SVGS[id] .replace(/(]*id="lk\d-name"[^>]*>)[^<]*/,'$1'+bn.replace(/&/g,'&').replace(//g,'>')) .replace(/(]*id="lk\d-name"[^>]*>)[^<]*/,'$1'+bn.replace(/&/g,'&').replace(//g,'>')) .replace(/(]*id="lk\d-tag"[^>]*>)[^<]*/,'$1'+bt.toUpperCase().split('').join(' ').replace(/&/g,'&').replace(//g,'>')); } function initLogos(){ document.querySelectorAll('[data-lk]').forEach(btn=>{ btn.addEventListener('click',async()=>{ const id=btn.dataset.lk,act=btn.dataset.act; const svg=getBrandedSVG(id); if(act==='svg'){ try{await navigator.clipboard.writeText(svg);toast(`Lockup ${id} · SVG copié`);} catch(e){ const ta=document.createElement('textarea');ta.value=svg;document.body.appendChild(ta); ta.select();document.execCommand('copy');ta.remove(); toast(`Lockup ${id} · SVG copié`); } } else if(act==='dl'){ if (window.guardDownload && !window.guardDownload()) return; const blob=new Blob([svg],{type:'image/svg+xml'}); const url=URL.createObjectURL(blob); const a=document.createElement('a'); a.href=url;a.download=`${window.brandSlug()}_Logo_Lockup_${id}.svg`;a.click(); setTimeout(()=>URL.revokeObjectURL(url),1500); toast(`Lockup ${id} téléchargé`); } }); }); } /* ════════════════════════════════════════════════════════════ 11 — SNIPCART PRODUCT CARD ════════════════════════════════════════════════════════════ */ const snipState={ id:'produit-demo-001', sku:'DEMO-001', name:'Produit démo 01', price:79, oldPrice:0, description:'Exemple fictif à personnaliser avec votre produit.', category:'ACCESSOIRE', stock:'EN STOCK', badge:'DÉMO', imageData:'' }; function initSnipcart(){ const c=document.querySelector('#snip-img canvas'); c.width=300;c.height=300; const inst=createLightning(c,{hue:state.hue,intensity:state.intensity*.6,speed:state.speed*.6,size:state.size}); allPreviews.push({inst,kind:'snipcart'}); ['id','sku','name','description','category'].forEach(k=>{ const el=document.getElementById('snip-'+k); el.addEventListener('input',e=>{snipState[k]=e.target.value;updateSnipCard();updateSnipCode();}); }); document.getElementById('snip-price').addEventListener('input',e=>{snipState.price=+e.target.value||0;updateSnipCard();updateSnipCode();}); document.getElementById('snip-old').addEventListener('input',e=>{snipState.oldPrice=+e.target.value||0;updateSnipCard();updateSnipCode();}); document.getElementById('snip-badge').addEventListener('change',e=>{snipState.badge=e.target.value;updateSnipCard();updateSnipCode();}); document.getElementById('snip-stock').addEventListener('change',e=>{snipState.stock=e.target.value;updateSnipCard();updateSnipCode();}); document.getElementById('snip-upload').addEventListener('change',e=>{ const f=e.target.files[0];if(!f)return; const reader=new FileReader(); reader.onload=ev=>{ snipState.imageData=ev.target.result; const img=document.getElementById('snip-img-tag'); img.src=snipState.imageData;img.style.display='block'; document.getElementById('snip-img-ph').style.display='none'; updateSnipCode(); }; reader.readAsDataURL(f); }); document.getElementById('snip-copy').addEventListener('click',async()=>{ try{await navigator.clipboard.writeText(getSnipHTML());toast('Snipcart HTML copié');} catch(e){ const ta=document.createElement('textarea');ta.value=getSnipHTML();document.body.appendChild(ta); ta.select();document.execCommand('copy');ta.remove(); toast('Snipcart HTML copié'); } }); document.getElementById('snip-dl-html').addEventListener('click',()=>{ if (window.guardDownload && !window.guardDownload()) return; const html=getSnipHTML(); const blob=new Blob([html],{type:'text/html'}); const url=URL.createObjectURL(blob); const a=document.createElement('a'); a.href=url;a.download=`${window.brandSlug()}-product-${snipState.id}.html`;a.click(); setTimeout(()=>URL.revokeObjectURL(url),1500); toast('Card HTML téléchargé'); }); updateSnipCard();updateSnipCode(); } function updateSnipCard(){ document.getElementById('snip-name-disp').textContent=snipState.name; document.getElementById('snip-cat-disp').textContent=snipState.category; document.getElementById('snip-desc-disp').textContent=snipState.description; document.getElementById('snip-price-disp').textContent=snipState.price+'€'; const oldEl=document.getElementById('snip-old-disp'); if(snipState.oldPrice>0){oldEl.textContent=snipState.oldPrice+'€';oldEl.style.display='inline';} else oldEl.style.display='none'; const stEl=document.getElementById('snip-stock-disp'); stEl.textContent=snipState.stock; stEl.classList.toggle('out',/rupture/i.test(snipState.stock)); const b=document.getElementById('snip-badge-disp'); if(snipState.badge){b.innerHTML=`${snipState.badge}`;b.style.display='inline-flex';} else b.style.display='none'; } function updateSnipCode(){ const html=getSnipHTML(); // Light syntax highlight const esc=html.replace(/&/g,'&').replace(//g,'>'); const hl=esc .replace(/(<!--[^]*?-->)/g,'$1') .replace(/(data-[a-z0-9-]+|class|href|alt|src|type|rel)=/g,'$1=') .replace(/"([^&]*?)"/g,'"$1"') .replace(/(<\/?)([a-zA-Z][a-zA-Z0-9]*)/g,'$1$2'); document.getElementById('snip-code').innerHTML=hl; } function getSnipHTML(){ const imgSrc=snipState.imageData?snipState.imageData:`/products/${snipState.id}.png`; return `
${snipState.badge?`
${snipState.badge}
`:''} ${snipState.name}
${snipState.category}

${snipState.name}

${snipState.description}

${snipState.price}€ ${snipState.oldPrice>0?`${snipState.oldPrice}€`:''}
${snipState.stock}
`; } /* ════════════════════════════════════════════════════════════ 12 — OPEN GRAPH IMAGE ════════════════════════════════════════════════════════════ */ const ogState={ category:'ACCESSOIRE', name:'Produit démo 01', tag:'Exemple fictif · visuel à personnaliser', price:'79€', oldPrice:'', badge:'DÉMO', imageData:null }; function initOG(){ const wrap=document.getElementById('og-prev'); const canvas=wrap.querySelector('canvas'); canvas.width=600;canvas.height=Math.round(600*630/1200); const inst=createLightning(canvas,{hue:state.hue,intensity:state.intensity*.65,speed:state.speed*.7,size:state.size}); allPreviews.push({inst,kind:'og'}); function updateName(){ const v=document.getElementById('og-name').value; const words=v.trim().split(/\s+/); if(words.length>1){ const last=words.pop(); document.getElementById('og-name-disp').innerHTML=words.join(' ')+' '+last+''; } else document.getElementById('og-name-disp').textContent=v; ogState.name=v;updateMeta(); } function updateBadge(){ const v=document.getElementById('og-badge').value; const el=document.getElementById('og-badge-disp'); if(v){el.textContent=v;el.style.display='inline-flex';}else el.style.display='none'; ogState.badge=v;updateMeta(); } function updateOld(){ const v=document.getElementById('og-old').value.trim(); const el=document.getElementById('og-old-disp'); el.textContent=v;el.style.display=v?'inline':'none'; ogState.oldPrice=v;updateMeta(); } document.getElementById('og-cat').addEventListener('input',e=>{ogState.category=e.target.value;document.getElementById('og-cat-disp').textContent=e.target.value;updateMeta();}); document.getElementById('og-name').addEventListener('input',updateName); document.getElementById('og-tag').addEventListener('input',e=>{ogState.tag=e.target.value;document.getElementById('og-tag-disp').textContent=e.target.value;updateMeta();}); document.getElementById('og-price').addEventListener('input',e=>{ogState.price=e.target.value;document.getElementById('og-price-disp').textContent=e.target.value;updateMeta();}); document.getElementById('og-old').addEventListener('input',updateOld); document.getElementById('og-badge').addEventListener('change',updateBadge); document.getElementById('og-upload').addEventListener('change',e=>{ const f=e.target.files[0];if(!f)return; const reader=new FileReader(); reader.onload=ev=>{ ogState.imageData=ev.target.result; const img=document.getElementById('og-product-img'); img.src=ogState.imageData;img.style.display='block'; document.getElementById('og-product-ph').style.display='none'; }; reader.readAsDataURL(f); }); document.getElementById('og-dl').addEventListener('click',async e=>{ if (window.guardDownload && !window.guardDownload()) return; const btn=e.currentTarget;btn.classList.add('loading'); await renderOG(1200,630); btn.classList.remove('loading'); }); document.getElementById('og-copy-meta').addEventListener('click',async()=>{ const html=getOGMetaTags(); try{await navigator.clipboard.writeText(html);toast('Meta tags Open Graph copiés');} catch(e){ const ta=document.createElement('textarea');ta.value=html;document.body.appendChild(ta); ta.select();document.execCommand('copy');ta.remove(); toast('Meta tags Open Graph copiés'); } }); updateMeta(); } function getOGMetaTags(){ const url='https://yourbrand.com/products/'+ogState.name.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,''); const title=ogState.name+' · YOUR BRAND'; const desc=ogState.tag+' · '+ogState.price; return ` `; } function updateMeta(){ const code=getOGMetaTags(); const esc=code.replace(/&/g,'&').replace(//g,'>'); const hl=esc .replace(/(<!--[^]*?-->)/g,'$1') .replace(/(property|name|content|charset)=/g,'$1=') .replace(/"([^&]*?)"/g,'"$1"') .replace(/(<\/?)(meta|link|title|head)/g,'$1$2'); const el=document.getElementById('og-meta-code'); if(el)el.innerHTML=hl; } async function renderOG(W,H,forKit=false){ await document.fonts.load(`700 80px ${FD}`); await document.fonts.load(`400 40px ${FB}`); const logo=await loadGearLogo(); const off=renderFrameAt(W,H,{...state,intensity:state.intensity*.65,speed:state.speed*.7}); const out=document.createElement('canvas');out.width=W;out.height=H; const ctx=out.getContext('2d'); ctx.fillStyle='#06060A';ctx.fillRect(0,0,W,H); ctx.drawImage(off,0,0); releaseKitFrame(off); // Dark overlay left side for text legibility const grad=ctx.createLinearGradient(0,0,W*.7,0); grad.addColorStop(0,'rgba(6,6,10,.85)'); grad.addColorStop(1,'rgba(6,6,10,.1)'); ctx.fillStyle=grad;ctx.fillRect(0,0,W,H); const pad=W*.05; const leftMax=W*.58; let y=H*.22; // Category ctx.font=`600 ${Math.round(H*.034)}px ${FD}`; ctx.fillStyle=kitPrimaryColor();ctx.textAlign='left';ctx.textBaseline='alphabetic'; ctx.fillText(ogState.category.split('').join(' '),pad,y); y+=H*.07; // Name (last word in orange) const words=ogState.name.split(/\s+/); const last=words.length>1?words.pop():''; const first=words.join(' '); const nfs=Math.round(H*.12); ctx.font=`700 ${nfs}px ${FD}`; ctx.textBaseline='top'; ctx.fillStyle='#fff'; ctx.fillText(first.toUpperCase(),pad,y); if(last){ const fw=ctx.measureText(first.toUpperCase()+' ').width; ctx.fillStyle=kitPrimaryColor(); ctx.fillText(last.toUpperCase(),pad+fw,y); } y+=nfs*1.05; // Tag (wrap if too long) ctx.font=`400 ${Math.round(H*.035)}px ${FB}`; ctx.fillStyle='rgba(255,255,255,.7)'; wrapText(ctx,ogState.tag,pad,y,leftMax,H*.045); y+=H*.1; // Price row const pfs=Math.round(H*.13); ctx.font=`700 ${pfs}px ${FD}`; ctx.fillStyle=kitPrimaryColor();ctx.textBaseline='alphabetic'; ctx.fillText(ogState.price,pad,y+pfs); const pw=ctx.measureText(ogState.price).width; if(ogState.oldPrice){ ctx.font=`500 ${Math.round(pfs*.38)}px ${FD}`; ctx.fillStyle='rgba(255,255,255,.45)'; ctx.fillText(ogState.oldPrice,pad+pw+H*.025,y+pfs*.55); const ow=ctx.measureText(ogState.oldPrice).width; ctx.strokeStyle='rgba(255,255,255,.45)';ctx.lineWidth=Math.max(2,W*.0025); ctx.beginPath();ctx.moveTo(pad+pw+H*.025,y+pfs*.45);ctx.lineTo(pad+pw+H*.025+ow,y+pfs*.45);ctx.stroke(); } // Badge top-right if(ogState.badge){ const bfs=Math.round(H*.038); ctx.font=`700 ${bfs}px ${FD}`; const btxt='● '+ogState.badge; const tw=ctx.measureText(btxt).width; const bw=tw+bfs*1.3,bh=bfs+bfs*.7; const bx=W-pad-bw,by=pad; ctx.fillStyle=kitPrimaryColor();ctx.fillRect(bx,by,bw,bh); ctx.fillStyle=kitTextColor();ctx.textAlign='left';ctx.textBaseline='middle'; ctx.fillText(btxt,bx+bfs*.65,by+bh/2); } // Right side: product image OR gear placeholder const rightCx=W*.79,rightCy=H*.5; if(ogState.imageData){ const pImg=new Image(); await new Promise(res=>{pImg.onload=res;pImg.onerror=res;pImg.src=ogState.imageData;}); const maxW=W*.36,maxH=H*.72; const r=Math.min(maxW/pImg.width,maxH/pImg.height); const iw=pImg.width*r,ih=pImg.height*r; ctx.save(); ctx.shadowColor='rgba(255,92,0,.45)';ctx.shadowBlur=H*.06; ctx.drawImage(pImg,rightCx-iw/2,rightCy-ih/2,iw,ih); ctx.restore(); } else if(logo){ const gs=H*.55; ctx.save(); ctx.globalAlpha=.55; ctx.shadowColor='rgba(255,92,0,.35)';ctx.shadowBlur=H*.05; ctx.drawImage(logo,rightCx-gs/2,rightCy-gs/2,gs,gs); ctx.restore(); } // Footer: gear + wordmark const footY=H-pad-H*.04; if(logo){ const fgS=H*.075; ctx.drawImage(logo,pad,footY-fgS*.5,fgS,fgS); } const wfs=Math.round(H*.044); ctx.font=`700 ${wfs}px ${FD}`; ctx.textAlign='left';ctx.textBaseline='middle'; ctx.fillStyle='#fff'; ctx.fillText(window.brandName().toUpperCase(),pad+H*.085,footY,W*.35); ctx.font=`500 ${Math.round(wfs*.42)}px ${FD}`; ctx.fillStyle='rgba(255,255,255,.55)'; ctx.textAlign='right'; ctx.fillText(window.brandTagline().toUpperCase(),W-pad,footY,W*.35); if(forKit)return out; out.toBlob(blob=>{ const url=URL.createObjectURL(blob); const a=document.createElement('a'); a.href=url;a.download=`${window.brandSlug()}_OG_${ogState.name.replace(/\s+/g,'-')}_1200x630.png`; a.click();setTimeout(()=>URL.revokeObjectURL(url),1500); toast('Open Graph image téléchargée'); },'image/png'); } function wrapText(ctx,text,x,y,maxW,lineH){ const words=text.split(' '); let line=''; for(let i=0;imaxW&&line){ ctx.fillText(line.trim(),x,y); line=words[i]+' ';y+=lineH; } else line=test; } ctx.fillText(line.trim(),x,y); } /* ════════════════════════════════════════════════════════════ 13 — FAVICON & PWA ICON KIT ════════════════════════════════════════════════════════════ */ const FAV_SIZES=[ {key:'favicon-16',w:16,h:16,name:'Favicon 16',ar:'1:1'}, {key:'favicon-32',w:32,h:32,name:'Favicon 32',ar:'1:1'}, {key:'favicon-48',w:48,h:48,name:'Favicon 48',ar:'1:1'}, {key:'apple-touch-icon',w:180,h:180,name:'Apple Touch',ar:'1:1'}, {key:'icon-192',w:192,h:192,name:'PWA 192',ar:'1:1'}, {key:'icon-512',w:512,h:512,name:'PWA 512',ar:'1:1'}, {key:'icon-maskable-512',w:512,h:512,name:'Maskable 512',ar:'1:1',maskable:true} ]; const favState={bg:'transparent',source:null}; async function initFavicon(){ const logo=await loadGearLogo(); if(!favState.source)favState.source=logo; const grid=document.getElementById('fav-grid'); grid.innerHTML=''; FAV_SIZES.forEach(s=>{ const c=document.createElement('div');c.className='fav-card'; const bgCls=`bg-${favState.bg}`; c.innerHTML=`
${s.name}
${s.w}×${s.h}px
`; grid.appendChild(c); }); renderAllFavicons(); // bg buttons document.querySelectorAll('.fav-bg-btn').forEach(b=>{ b.addEventListener('click',()=>{ document.querySelectorAll('.fav-bg-btn').forEach(x=>x.classList.remove('act')); b.classList.add('act'); favState.bg=b.dataset.bg; // update stage bg classes document.querySelectorAll('.fav-stage').forEach(stage=>{ stage.classList.remove('bg-transparent','bg-carbone','bg-orange','bg-white'); stage.classList.add('bg-'+favState.bg); }); renderAllFavicons(); updateFavHTML(); }); }); // download single grid.addEventListener('click',e=>{ const btn=e.target.closest('[data-dl]'); if(!btn)return; if (window.guardDownload && !window.guardDownload()) return; const size=FAV_SIZES.find(s=>s.key===btn.dataset.dl); if(size)downloadOneFavicon(size); }); // upload custom source document.getElementById('fav-upload').addEventListener('change',e=>{ const f=e.target.files[0];if(!f)return; const img=new Image(); img.onload=()=>{favState.source=img;renderAllFavicons();toast('Source custom appliquée');}; img.src=URL.createObjectURL(f); }); document.getElementById('fav-copy-html').addEventListener('click',async()=>{ try{await navigator.clipboard.writeText(getFaviconHTML());toast('HTML head copié');} catch(e){ const ta=document.createElement('textarea');ta.value=getFaviconHTML();document.body.appendChild(ta); ta.select();document.execCommand('copy');ta.remove(); toast('HTML head copié'); } }); document.getElementById('fav-download-all').addEventListener('click',async()=>{ if (window.requireEmail) { const ok = await window.requireEmail(); if (ok === null) return; if (!ok) { alert('Impossible de débloquer le kit. Vérifie ton email et réessaie.'); return; } } for(const s of FAV_SIZES){ await downloadOneFavicon(s); await new Promise(r=>setTimeout(r,180)); } toast('7 icônes téléchargées'); }); document.getElementById('fav-download-manifest').addEventListener('click',()=>{ const m=getManifest(); const blob=new Blob([m],{type:'application/manifest+json'}); const url=URL.createObjectURL(blob); const a=document.createElement('a'); a.href=url;a.download='manifest.webmanifest';a.click(); setTimeout(()=>URL.revokeObjectURL(url),1500); toast('manifest.webmanifest téléchargé'); }); updateFavHTML(); } function drawFaviconTo(ctx,W,H,maskable){ ctx.clearRect(0,0,W,H); if(favState.bg==='carbone'){ctx.fillStyle='#06060A';ctx.fillRect(0,0,W,H);} else if(favState.bg==='orange'){ctx.fillStyle='#FF5C00';ctx.fillRect(0,0,W,H);} else if(favState.bg==='white'){ctx.fillStyle='#FAFAFA';ctx.fillRect(0,0,W,H);} if(!favState.source)return; // safe-zone for maskable: gear occupies 75% center const padR=maskable?.18:.06; const target=W*(1-padR*2); const ratio=favState.source.height/favState.source.width; let dw=target,dh=target*ratio; if(dh>W*(1-padR*2)){dh=W*(1-padR*2);dw=dh/ratio;} const dx=(W-dw)/2,dy=(H-dh)/2; ctx.drawImage(favState.source,dx,dy,dw,dh); } function renderAllFavicons(){ // Preview always at high res for clarity (256x256) — actual size used only on export const PREV=256; FAV_SIZES.forEach(s=>{ const c=document.querySelector(`canvas[data-k="${s.key}"]`); if(!c)return; if(c.width!==PREV)c.width=c.height=PREV; const ctx=c.getContext('2d'); drawFaviconTo(ctx,PREV,PREV,s.maskable); }); } async function downloadOneFavicon(s){ const out=document.createElement('canvas');out.width=s.w;out.height=s.h; const ctx=out.getContext('2d'); drawFaviconTo(ctx,s.w,s.h,s.maskable); return new Promise(res=>{ out.toBlob(blob=>{ const url=URL.createObjectURL(blob); const a=document.createElement('a'); a.href=url;a.download=`${s.key}.png`;a.click(); setTimeout(()=>URL.revokeObjectURL(url),800); res(); },'image/png'); }); } function updateFavHTML(){ const html=getFaviconHTML(); const esc=html.replace(/&/g,'&').replace(//g,'>'); const hl=esc .replace(/(<!--[^]*?-->)/g,'$1') .replace(/(rel|sizes|href|type|name|content)=/g,'$1=') .replace(/"([^&]*?)"/g,'"$1"') .replace(/(<\/?)(link|meta)/g,'$1$2'); document.getElementById('fav-html-code').innerHTML=hl; } function getFaviconHTML(){ return ` `; } function getManifest(){ return JSON.stringify({ name:"Your Brand", short_name:"YB", description:"Your brand description here", start_url:"/", display:"standalone", background_color:"#06060A", theme_color:"#06060A", orientation:"portrait", icons:[ {src:"/icons/icon-192.png",sizes:"192x192",type:"image/png",purpose:"any"}, {src:"/icons/icon-512.png",sizes:"512x512",type:"image/png",purpose:"any"}, {src:"/icons/icon-maskable-512.png",sizes:"512x512",type:"image/png",purpose:"maskable"} ] },null,2); } /* ════════════════════════════════════════════════════════════ TOAST ════════════════════════════════════════════════════════════ */ let toastT; function toast(msg){ const t=document.getElementById('toast'); document.getElementById('toast-msg').textContent=msg; t.classList.add('show'); clearTimeout(toastT); toastT=setTimeout(()=>t.classList.remove('show'),2400); } /* ════════════════════════════════════════════════════════════ INIT ════════════════════════════════════════════════════════════ */ function init(){ const amb=document.getElementById('ambient-canvas'); amb.width=window.innerWidth;amb.height=window.innerHeight; window.__amb=createDirectLightning(amb); window.addEventListener('resize',()=>{amb.width=window.innerWidth;amb.height=window.innerHeight}); const hero=document.getElementById('hero-shader-canvas'); if(hero){ const sizeHero=()=>{ const r=hero.getBoundingClientRect(),d=Math.min(window.devicePixelRatio||1,1.6); hero.width=Math.max(1,Math.round(r.width*d));hero.height=Math.max(1,Math.round(r.height*d)); }; sizeHero();window.__heroShader=createLightning(hero,{alpha:1}); window.addEventListener('resize',sizeHero,{passive:true}); } buildWallpaperGallery(); initProductPost(); initEmail(); initBCard(); initGif(); initPoster(); initStickers(); initLinktree(); initLogos(); initSnipcart(); initOG(); initFavicon(); initPhotoInsta(); applyState(); // Motion (last-10) : révèle le panneau actif une fois galeries construites + fonts prêtes. if(window.revealPanel)window.revealPanel(document.querySelector('.panel.act')); } /* ════════════════════════════════════════════════════════════ 14 — PHOTO INSTA Drop a photo, add your branding on top, export at IG ratios. No shader, no bg removal — designed for concrete/garage shots. ════════════════════════════════════════════════════════════ */ const PI_FORMATS={ '1x1' :{w:1080,h:1080,label:'1080 × 1080'}, '4x5' :{w:1080,h:1350,label:'1080 × 1350'}, '9x16':{w:1080,h:1920,label:'1080 × 1920'} }; const piState={ img:null, imgName:'', format:'1x1', logo:true, stamp:true, handle:true, hash:false, frame:false, logoAnchor:'br', logoColor:'#ffffff', logoSize:12, logoVariant:'mark', text:'', textAnchor:'bl', textColor:'#ffffff', vignette:true, grain:true, grainAmt:14, boost:false, dim:false }; // Logo variants — sizeBoost compensates for wide/text-heavy lockups so the slider stays usable const PI_LOGO_VARIANTS={ 'mark': {url:'your-logo.png', sizeBoost:1.0}, 'mark-clean': {url:'your-logo-clean.png', sizeBoost:1.0}, 'mark-official':{url:'your-logo-official.png', sizeBoost:1.0}, 'lockup': {url:'your-lockup.png', sizeBoost:2.2} }; const piLogoCache={}; function piEnsureLogo(){ const v=PI_LOGO_VARIANTS[piState.logoVariant]||PI_LOGO_VARIANTS['mark']; if(piLogoCache[piState.logoVariant]) return Promise.resolve(piLogoCache[piState.logoVariant]); return new Promise(res=>{ const i=new Image(); i.crossOrigin='anonymous'; i.onload=()=>{piLogoCache[piState.logoVariant]=i;res(i)}; i.onerror=()=>{piLogoCache[piState.logoVariant]=null;res(null)}; i.src=v.url; }); } function piAnchorXY(a,w,h,pad){ const m=pad||Math.round(Math.min(w,h)*0.05); let x=w/2,y=h/2,ax=0.5,ay=0.5; a=(a||'br').toLowerCase(); if(a[0]==='t'){y=m;ay=0} else if(a[0]==='b'){y=h-m;ay=1} else if(a[0]==='m'){y=h/2;ay=0.5} if(a[1]==='l'){x=m;ax=0} else if(a[1]==='r'){x=w-m;ax=1} else if(a[1]==='c'){x=w/2;ax=0.5} return {x,y,ax,ay,m}; } function piDrawCovered(ctx,img,w,h){ const iw=img.naturalWidth||img.width,ih=img.naturalHeight||img.height; const s=Math.max(w/iw,h/ih); const dw=iw*s,dh=ih*s; ctx.drawImage(img,(w-dw)/2,(h-dh)/2,dw,dh); } function piApplyBoost(ctx,w,h){ try{ const data=ctx.getImageData(0,0,w,h); const tmp=document.createElement('canvas'); tmp.width=w;tmp.height=h; tmp.getContext('2d').putImageData(data,0,0); ctx.clearRect(0,0,w,h); ctx.filter='contrast(1.10) saturate(1.18) brightness(1.04)'; ctx.drawImage(tmp,0,0); ctx.filter='none'; }catch(_){/* tainted canvas — skip */} } function piDrawDim(ctx,w,h){ ctx.save(); ctx.fillStyle='rgba(0,0,0,0.22)'; ctx.fillRect(0,0,w,h); ctx.restore(); } function piDrawVignette(ctx,w,h){ const cx=w/2,cy=h/2; const r0=Math.min(w,h)*0.55, r1=Math.hypot(cx,cy)*1.05; const g=ctx.createRadialGradient(cx,cy,r0,cx,cy,r1); g.addColorStop(0,'rgba(0,0,0,0)'); g.addColorStop(1,'rgba(0,0,0,0.55)'); ctx.save();ctx.fillStyle=g;ctx.fillRect(0,0,w,h);ctx.restore(); } function piDrawGrain(ctx,w,h,amount){ if(amount<=0) return; const tile=220; const g=document.createElement('canvas');g.width=tile;g.height=tile; const gx=g.getContext('2d'); const id=gx.createImageData(tile,tile),d=id.data; const a=Math.max(0,Math.min(1,amount/100)); for(let i=0;i=ih){ lw=targetMax; lh=Math.round(targetMax*(ih/iw)); } else { lh=targetMax; lw=Math.round(targetMax*(iw/ih)); } const p=piAnchorXY(piState.logoAnchor,w,h); let x=p.x-lw*p.ax, y=p.y-lh*p.ay; // Collision avoidance — push logo off the pills/stamp that share its corner const anchor=(piState.logoAnchor||'br').toLowerCase(); const reserve=Math.round(Math.min(w,h)*0.030)+Math.round(Math.min(w,h)*0.030*0.7)*2+18; if(piState.handle && anchor==='br') y-=reserve; if(piState.hash && anchor==='tr') y+=reserve; if(piState.stamp && (anchor==='tl'||anchor==='tc')) y+=Math.round(Math.min(w,h)*0.110); // Tint (white = keep original artwork) const off=document.createElement('canvas');off.width=lw;off.height=lh; const oc=off.getContext('2d'); oc.drawImage(logoImg,0,0,lw,lh); const tint=(piState.logoColor||'#ffffff').toLowerCase(); if(tint!=='#ffffff'&&tint!=='#fff'){ oc.globalCompositeOperation='source-in'; oc.fillStyle=tint; oc.fillRect(0,0,lw,lh); } ctx.save(); ctx.shadowColor='rgba(0,0,0,0.55)'; ctx.shadowBlur=Math.max(10,Math.min(lw,lh)*0.12); ctx.shadowOffsetY=Math.max(2,Math.min(lw,lh)*0.04); ctx.drawImage(off,x,y,lw,lh); ctx.restore(); } function piDrawText(ctx,w,h){ const t=(piState.text||'').trim(); if(!t) return; const fs=Math.round(Math.min(w,h)*0.058); const p=piAnchorXY(piState.textAnchor,w,h); ctx.save(); ctx.font=`700 ${fs}px ${FD},Inter,sans-serif`; ctx.textBaseline=p.ay===1?'bottom':(p.ay===0?'top':'middle'); ctx.textAlign=p.ax===1?'right':(p.ax===0?'left':'center'); ctx.shadowColor='rgba(0,0,0,0.75)'; ctx.shadowBlur=Math.max(8,fs*0.18); ctx.shadowOffsetY=Math.max(3,fs*0.06); ctx.fillStyle=piState.textColor||'#fff'; ctx.fillText(t.toUpperCase(),p.x,p.y); ctx.restore(); } async function piDraw(){ const f=PI_FORMATS[piState.format]||PI_FORMATS['1x1']; const canvas=document.getElementById('pi-canvas'); if(!canvas) return; canvas.width=f.w; canvas.height=f.h; const ctx=canvas.getContext('2d'); ctx.clearRect(0,0,f.w,f.h); const fmtMeta=document.getElementById('pi-fmt-meta');if(fmtMeta) fmtMeta.textContent=f.label; const photoMeta=document.getElementById('pi-photo-meta'); const prev=document.getElementById('pi-prev'); if(prev){ prev.classList.toggle('f-4x5',piState.format==='4x5'); prev.classList.toggle('f-9x16',piState.format==='9x16'); prev.classList.toggle('has-img',!!piState.img); } if(!piState.img){ if(photoMeta) photoMeta.textContent='aucune photo'; document.getElementById('pi-dl-png').disabled=true; document.getElementById('pi-dl-jpg').disabled=true; return; } if(photoMeta) photoMeta.textContent=piState.imgName||'photo prête'; document.getElementById('pi-dl-png').disabled=false; document.getElementById('pi-dl-jpg').disabled=false; piDrawCovered(ctx,piState.img,f.w,f.h); if(piState.boost) piApplyBoost(ctx,f.w,f.h); if(piState.dim) piDrawDim(ctx,f.w,f.h); if(piState.vignette) piDrawVignette(ctx,f.w,f.h); if(piState.grain) piDrawGrain(ctx,f.w,f.h,piState.grainAmt); if(piState.frame) piDrawFrame(ctx,f.w,f.h); if(piState.stamp) piDrawStamp(ctx,f.w,f.h); if(piState.hash) piDrawHash(ctx,f.w,f.h); if(piState.handle) piDrawHandle(ctx,f.w,f.h); if(piState.logo){ const logo=await piEnsureLogo(); piDrawLogo(ctx,f.w,f.h,logo); } piDrawText(ctx,f.w,f.h); } function piExport(kind){ if (window.guardDownload && !window.guardDownload()) return; if(!piState.img) return; const canvas=document.getElementById('pi-canvas'); const mime=kind==='jpg'?'image/jpeg':'image/png'; const q=kind==='jpg'?0.92:undefined; canvas.toBlob(blob=>{ if(!blob) return; const stamp=new Date().toISOString().slice(0,10); const base=(piState.imgName||'photo').replace(/\.[^/.]+$/,''); const url=URL.createObjectURL(blob); const a=document.createElement('a'); a.href=url; a.download=`${window.brandSlug()}_insta_${piState.format}_${base}_${stamp}.${kind}`; document.body.appendChild(a);a.click();a.remove(); setTimeout(()=>URL.revokeObjectURL(url),4000); showToast(`Export ${kind.toUpperCase()} prêt`); },mime,q); } function initPhotoInsta(){ const fileInput=document.getElementById('pi-upload'); const nameEl=document.getElementById('pi-upload-name'); if(fileInput){ fileInput.addEventListener('change',e=>{ const f=e.target.files&&e.target.files[0]; if(!f) return; const reader=new FileReader(); reader.onload=ev=>{ const img=new Image(); img.onload=()=>{ piState.img=img; piState.imgName=f.name||'photo'; if(nameEl) nameEl.textContent=`${f.name} · ${img.naturalWidth}×${img.naturalHeight}`; piDraw(); }; img.onerror=()=>showToast('Image illisible'); img.src=ev.target.result; }; reader.readAsDataURL(f); }); } document.querySelectorAll('.pi-fmt-btn').forEach(b=>{ b.addEventListener('click',()=>{ piState.format=b.dataset.fmt; document.querySelectorAll('.pi-fmt-btn').forEach(x=>x.classList.toggle('act',x===b)); piDraw(); }); }); document.querySelectorAll('.pi-toggle').forEach(t=>{ t.addEventListener('click',()=>{ const k=t.dataset.flag; piState[k]=!piState[k]; t.classList.toggle('on',piState[k]); piDraw(); }); }); document.querySelectorAll('#pi-logo-anchor .pi-cell').forEach(c=>{ c.addEventListener('click',()=>{ piState.logoAnchor=c.dataset.a; document.querySelectorAll('#pi-logo-anchor .pi-cell').forEach(x=>x.classList.toggle('act',x===c)); piDraw(); }); }); document.querySelectorAll('#pi-text-anchor .pi-cell').forEach(c=>{ c.addEventListener('click',()=>{ piState.textAnchor=c.dataset.a; document.querySelectorAll('#pi-text-anchor .pi-cell').forEach(x=>x.classList.toggle('act',x===c)); piDraw(); }); }); document.querySelectorAll('#pi-logo-color .pi-sw-color').forEach(s=>{ s.addEventListener('click',()=>{ piState.logoColor=s.dataset.c; document.querySelectorAll('#pi-logo-color .pi-sw-color').forEach(x=>x.classList.toggle('act',x===s)); piDraw(); }); }); document.querySelectorAll('#pi-logo-variants .pi-lv').forEach(v=>{ v.addEventListener('click',()=>{ piState.logoVariant=v.dataset.variant; document.querySelectorAll('#pi-logo-variants .pi-lv').forEach(x=>x.classList.toggle('act',x===v)); piDraw(); }); }); document.querySelectorAll('#pi-text-color .pi-sw-color').forEach(s=>{ s.addEventListener('click',()=>{ piState.textColor=s.dataset.c; document.querySelectorAll('#pi-text-color .pi-sw-color').forEach(x=>x.classList.toggle('act',x===s)); piDraw(); }); }); const grainR=document.getElementById('pi-grain'); if(grainR){ grainR.addEventListener('input',e=>{ piState.grainAmt=parseInt(e.target.value,10)||0; const v=document.getElementById('pi-grain-v');if(v) v.textContent=piState.grainAmt+'%'; piDraw(); }); } const sizeR=document.getElementById('pi-logo-size'); if(sizeR){ sizeR.addEventListener('input',e=>{ piState.logoSize=parseInt(e.target.value,10)||12; const v=document.getElementById('pi-logo-size-v');if(v) v.textContent=piState.logoSize+'%'; piDraw(); }); } const txt=document.getElementById('pi-text'); if(txt){ txt.addEventListener('input',e=>{ piState.text=String(e.target.value||'').slice(0,30); piDraw(); }); } document.getElementById('pi-dl-png').addEventListener('click',()=>piExport('png')); document.getElementById('pi-dl-jpg').addEventListener('click',()=>piExport('jpg')); piDraw(); } window.forgemReady=document.fonts.ready.then(init); // Les PNG du kit sont construits avec les rendus finaux, pas avec les // arrière-plans des aperçus dont le texte et les images sont dans le DOM. window.getBrandKitRenderers=async function(){ await window.forgemReady; if(!_activeFrag)throw new Error('Le moteur visuel n’est pas chargé.'); const outputs=[ {name:'post-produit.png',render:()=>renderProductTo(1080,1080,'png',true)}, {name:'email-header.png',render:()=>renderEmailHeader(1200,400,true)}, {name:'carte-recto.png',render:()=>renderBCard('front',1004,649,true)}, {name:'carte-verso.png',render:()=>renderBCard('back',1004,649,true)}, {name:'poster-a4.png',render:()=>renderPoster(2480,3508,true)}, {name:'liens-mobile.png',render:()=>renderLinktreePNG(1080,1920,true)}, {name:'image-partage.png',render:()=>renderOG(1200,630,true)} ]; if(piState.img) outputs.push({name:'photo-insta.png',render:async()=>{ await piDraw();return document.getElementById('pi-canvas'); }}); return outputs; }; window.rerenderModules = function () { try { if (typeof buildWallpaperGallery === 'function') buildWallpaperGallery(); } catch (e) {} try { if (typeof window.syncPosterHeadline === 'function') window.syncPosterHeadline(); } catch (e) {} }; window.state = state; (function(){ var defs=[['s-hue','v-hue','hue',function(v){return Math.round(v)+'°';}], ['s-int','v-int','intensity',function(v){return (+v).toFixed(2);}], ['s-spd','v-spd','speed',function(v){return (+v).toFixed(1);}], ['s-sz','v-sz','size',function(v){return (+v).toFixed(1);}]]; defs.forEach(function(d){ var el=document.getElementById(d[0]); if(!el) return; var out=document.getElementById(d[1]); el.value=state[d[2]]; if(out) out.textContent=d[3](state[d[2]]); el.addEventListener('input',function(){ state[d[2]]=parseFloat(el.value); if(out) out.textContent=d[3](el.value); }); el.addEventListener('change',function(){ try{ if(window.rerenderModules) window.rerenderModules(); }catch(e){} }); }); })(); window.brandName = () => (window.__brand && window.__brand.name) || 'Your Brand'; window.brandTagline = () => (window.__brand && window.__brand.tagline) || 'Your tagline here'; window.brandSlug = () => window.brandName().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'brandkit'; window.guardDownload = function () { if (window.freeDownloadsLeft && window.freeDownloadsLeft() === 0) { alert('Limite gratuite atteinte (3 assets). Télécharge le kit de visuels — email requis.'); return false; } if (window.noteFreeDownload) window.noteFreeDownload(); return true; };